package com.magic233.service;

import com.magic233.entity.Logs;
import com.magic233.mapper.LogsMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * ClassName: LogsServiceImpl
 * Description:
 * date: 2021/5/29 21:51
 * author: zouyuan
 */
@Service
public class LogsServiceImpl implements LogsService {
    @Autowired
    private LogsMapper logsMapper;

    @Override
    public int addLog(String thing) {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
        Long id = new Date().getTime();
        String time = simpleDateFormat.format(id);
        Logs log = new Logs(id, time, thing);
        int re = logsMapper.insert(log);
        return re;
    }
}
